package cn.jsj.machine.service;

import cn.jsj.machine.pojo.CMachine;
import cn.jsj.machine.pojo.CPart;
import org.hibernate.validator.constraints.Length;
import org.springframework.validation.annotation.Validated;

import javax.validation.Valid;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.util.List;
import java.util.Map;

@Validated
public interface MachineService {

    public void resetMachineDescription(@NotNull@Min(value = 1) Integer account,@NotBlank@Length(min = 5,max = 15) String password,@NotNull@Min(value = 1) Integer machineID,@NotBlank@Length(max = 225) String str);

    public void deleteMachine(@NotNull@Min(value = 1) Integer account,@NotBlank@Length(min = 5,max = 15) String password,@NotNull@Min(value = 1) Integer machineID);

    public void changePartNeedNumber(@NotNull@Min(value = 1) Integer account,@NotNull@Length(min = 5,max = 15) String password,@NotNull@Min(value = 1) Integer machineID,@NotNull@Min(value = 1) Integer partID,@NotNull@Min(value = 1) Integer needNmb);

    @Valid
    public List<CPart> getOneMachineParts(@NotNull@Min(value = 1) Integer account,@NotBlank@Length(min = 5,max = 15) String password,@NotNull@Min(value = 1) Integer mechineID);

    public void addOnePartToMachine(@NotNull@Min(value = 1) Integer account,@NotBlank@Length(min = 5,max = 15) String password,@NotNull@Min(value = 1) Integer machineID,@NotNull@Min(value = 1) Integer partID,@NotNull@Min(value = 1) Integer number, boolean checkMachine, boolean checkPart,boolean checkIdentity);

    public void addOnePartToMachineWithPartName(@NotNull@Min(value = 1) Integer account,@NotBlank@Length(min = 5,max = 15) String password,@NotNull@Min(value = 1) Integer machineID,@NotBlank@Length(max = 20) String partName,@NotNull@Min(value = 0) Integer needNumber);

    @Valid
    public Integer insertOneMachine(@NotNull@Min(value = 1) Integer account,@NotBlank@Length(min = 5,max = 15) String password, @NotBlank@Length(min = 1,max = 20,message = "产品名称不能超过20个字") String machineName, @NotNull Map<Integer,Integer> partList);

    @Valid
    public List<CMachine> getMachineList(@NotNull@Min(value = 1) Integer account,@NotBlank@Length(min = 5,max = 15) String password);

    public void deleteOnePartFromMachine(Integer account, String password, Integer machineID, Integer partID);

    public void productOneMachine(@NotNull@Min(value = 1) Integer account,@NotBlank@Length(min = 5,max = 15) String password,@NotNull@Min(value = 1) Integer machineID,@NotNull@Min(value = 0) Integer cutNumber);

    public void machineReName(@NotNull@Min(value = 1) Integer account,@NotBlank@Length(min = 5,max = 15) String password,@NotNull@Min(value = 1) Integer machineID,@NotBlank@Length(max = 20,message = "产品名称不能超过20个字") String newName);
}
